package com.demo.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class CommonDAO {

	@Autowired
	SessionFactory sessionFactory;


	public void insertRow(Object objectToInsert){

		Session session=sessionFactory.openSession();
		session.beginTransaction();
		session.save(objectToInsert);
		session.getTransaction().commit();
		session.close();
		
	}

	public void updateRow(Object objectToUpdate){

		Session session=sessionFactory.openSession();
		session.beginTransaction();
		session.save(objectToUpdate);
		session.getTransaction().commit();
		session.close();
	}



}
